<!doctype html>
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>后台登录-LoveWall2.0</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="__STATICS__/css/font.css">
    <link rel="stylesheet" href="__STATICS__/css/login.css">
	<link rel="stylesheet" href="__STATICS__/css/xadmin.css">
	<link rel="stylesheet" href="__STATICS__/layui/css/layui.css">
    <script src="__STATICS__/layui/layui.js" charset="utf-8"></script>
    <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">AdminLogin for LoveWall-2.0 </div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="password" lay-verify="pass" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
			<div id="slider"></div>
			<!--<button class="layui-btn" type="button" id="reset">重置滑块</button>-->
			<hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
    </div>
	<script type="text/javascript" charset="utf-8">
		layui.config({
			base: '__STATIC__/layui/lay/plugs/'
		}).use(['sliderVerify', 'jquery', 'form'], function() {
			var sliderVerify = layui.sliderVerify,
				$ = layui.jquery
				,form = layui.form;
			var slider = sliderVerify.render({
				elem: '#slider'
				,bg : 'layui-bg-red'//自定义背景样式名
				,onOk(){
					layer.msg("滑块验证通过");
				}
			})
			//$('#reset').on('click',function(){
				//slider.reset();
			//})
			//监听提交
			form.on('submit(login)', function(data) {
				if(slider.isOk()){
					$.ajax({
                    url:"{:url('comm/login')}"
                    ,dataType:'JSON'
                    ,data:{data:JSON.stringify(data.field)}
                    ,type:'POST'
                    ,success:function(data){
                        if(data.code==0){
                            layer.msg(data.msg,{icon:1},function(){
                                location.href="/admin/index";
                            });
                        }else if(data.code==-2){
                            layer.msg(data.msg,{icon:2},function(index){
                                location.href="{:url('comm/login_em')}"
                            })    
                        }
                        else{
                            layer.msg(data.msg,{icon:2});
                        }
                    }
                })
				}else{
					layer.msg("请先通过滑块验证");
				}
				return false;
			});
		})
	</script>
    <!-- 底部结束 -->
</body>
</html>